import java.util.*;

public class Test {
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String oldStr = in.nextLine();
        String newStr = in.nextLine();
        HashSet<Character> set = new HashSet<>();

        for(int i = 0; i < oldStr.length(); i++){
            char ch = oldStr.charAt(i);
            set.add(ch);
            if(ch >= 'A' && ch <= 'Z'){
                char ch2 = (char)(ch - 'A' + 'a');
                set.add(ch2);
            }
        }

        StringBuffer result = new StringBuffer();

        for(int i = 0; i < newStr.length(); i++){
            char ch = newStr.charAt(i);
            if(!set.contains(ch)){
                if(ch >= 'A' && ch <= 'Z' && set.contains('+')){
                    continue;
                }
                else
                    result.append(ch);
            }
        }

        System.out.println(result.toString());
    }
}
